export function checkWinner(list) {
  const results = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
  ]
  for (let i = 0; i < results.length; i++) {
    const item = results[i]
    // 不为null && [0] === [1] && [0] === [2]
    // if (list[item[0]] && list[item[0]] === list[item[1]] && list[item[0]] === list[item[2]]) {
    if (list[item[0]] && list[item[0]] === list[item[1]] && list[item[0]] === list[item[2]]) {
      return item
      /*return {
        val: list[item[0]],
        line: item
      }*/
    }
    // console.log(list[item[0]])
    // console.log(list[item[1]])
    // console.log(list[item[2]])
    // console.log("==================")
  }
  // [null, null, "x", "o", null, "x", ...]
}
